package Exercise;

import java.util.Locale;
import java.util.Scanner;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class Exercise03 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入名字:>");
        String name = scanner.nextLine();//nextLine:接收空格
        print(name);
//            String name = "Wang Yi Xi";
//            print(name);
    }
    public static void print(String name){
        if(name == null){
            System.out.println("名字不能为空");
            return;
        }
        String s[] = name.split(" ");
        if(s.length != 3){
            System.out.println("输入的名字格式不正确!");
            return;
        }
        String s1 = String.format("%s,%s.%c",s[2],s[0],s[1].toUpperCase(Locale.ROOT).charAt(0));
        System.out.println(s1);
    }
}
